<?php

namespace App\Models\Crm;

use Illuminate\Database\Eloquent\Model;

class Application extends Model
{
    /***按排序字段倒序排序
     * @param $query
     * @return mixed
     */
    public function scopeSorted($query)
    {
        return $query->orderBy('sort_order', 'desc');
    }

    /***
     * 按时间倒序
     * @param $query
     * @return mixed
     */
    public function scopeCreated_at_desc($query)
    {
        return $query->orderBy('created_at', 'desc');
    }

    /***
     * 按ID倒序
     * @param $query
     * @return mixed
     */
    public function scopeId_desc($query)
    {
        return $query->orderBy('id', 'desc');
    }
}
